package practice4;

import java.util.Scanner;

public class P2675 {

    static int n,m,limit;
    static int[][] matrix;

    //求高为a,宽为b的滑动窗口能得到的最小的稳定度
    public static int getStable(int a,int b){
        int x=n-a+1,y=m-b+1;
        int stable=Integer.MAX_VALUE;
        for(int r=1;r<=x;r++){
            for(int c=1;c<=y;c++){
                int max=0,min=Integer.MAX_VALUE;
                for(int i=r;i<=r+a-1;i++){
                    for(int j=c;j<=c+b-1;j++){
                        if(matrix[i][j]>max){
                            max=matrix[i][j];
                        }
                        if(matrix[i][j]<min){
                            min=matrix[i][j];
                        }
                    }
                }
                if(max-min<stable){
                    stable=max-min;
                }
            }
        }
        return stable;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        m=sc.nextInt();
        matrix = new int[n+1][m+1];
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                matrix[i][j]=sc.nextInt();
            }
        }
        limit=sc.nextInt();
        int a=n,b=m;
        while(a*b>1){
            int stable = getStable(a,b);
            if(stable<=limit){
                System.out.println(a*b);
                return;
            }else{
                if(a>b){
                    a--;
                }else{
                    b--;
                }
            }
        }
        System.out.println(1);
    }
}
